<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>
  
  <head>    
    <title>Let's make some ice!</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link href="../../styles.css" rel="stylesheet">
    <link rel="icon" href="../../images/icon.png">
	</head>

	<body>

    <div id="top">
      <h1>Let's make some ice!</h1> 
    </div>
			
    <div id="hot-links">
      <h2>Direct links</h2>
      <hr>
      <ol>
        <li><a href="../../index.html">Introduction</a></li>
        <li><a href="../tutorials.html">Tutorials</a></li>
        <li><a href="../resources.html">Resources</a></li>
      </ol>
    </div>
			
    <div id="main">
        
      <h2>Contents</h2>
      <hr>
      <ol>
        <li><a href="#tools">Required tools</a></li>
        <li><a href="#tutorials">Required tutorials</a></li>
        <li><a href="#steps">Steps</a></li>
      </ol>
      <br>

      <hr id="tools">
      <h2>Required tools</h2>
      <hr>
      <p>Go to <a href="../resources.html">Resources</a> for download links.</p>        
      <ul>
        <li>Blender</li>
        <li>SuperBMD</li>
        <li>j3dview</li>
        <li>Any text editor you like (Notepad++ is recommended)</li>
        <li>NeoKCLCreate</li>
        <li>Arc Convertor</li>
        <li>Whitehole</li>
        <li>Wiimm's ISO Tools (to get your SMG1 dump)</li>
      </ul>
      <br>

      <hr id="tutorials">
      <h2>Required tutorials</h2>
      <hr>
      <ul>
        <li><a href="t1.html">How to import a custom model into SMG1</a></li>
        <li><a href="t2.html">How to import a custom model into SMG1 with 1 in-game material</a></li>
        <li><a href="t3.html">How to import a custom model into SMG1 with 2 or more in-game materials</a></li>
      </ul>
      <br>

      <hr id="steps">
      <h2>Steps --- files used: <a href="https://archive.org/download/humming-owl-storage/tutorial5.zip">tutorial5.zip</a></h2>
      <hr>

      <p>In this tutorial I will show you how to make a <b>custom model</b> that works with several <b>in-game materials</b> that when combined generate a certain overall effect, <b>a nice looking ice effect</b>. The object containing that <b>ice visual effect</b>, which will be used as a reference for our <b>custom model</b>, is found in <b>SMG1</b>.  It is the <code>IceRingIcePlanet</code> object from the <b>IceVolcanoGalaxy</b> (<b>Fig. 1</b>).</p>

      <img src="../../images/t5/fig1.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 1 - <code>IceRingIcePlanet</code> object)</p>
      <br>

      <p>Extract the contents of the <b>ARC file</b> of the model, and extract the contents of the <b>BDL file</b>. Then, open with <b>Blender</b> the <b>DAE file</b> created by <b>SuperBMD</b> (<b>Fig. 2</b>). As you can see, this object is divided in <b>3 pieces</b>, one inside another and there is a <b>single material applied to each part</b> (<b>Fig. 3a, 3b and 3c</b>).</p>

      <img src="../../images/t5/fig2.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 2 - Figures composing the <code>IceRingIcePlanet</code> object)</p>
      <br>

      <img src="../../images/t5/fig3a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 3a)</p>
      <br>

      <img src="../../images/t5/fig3b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 3b)</p>
      <br>

      <img src="../../images/t5/fig3c.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 3c)</p>
      <br>

      <p>It is the combination of these <b>3 figures</b> with these <b>3 materials</b> that makes it so this object looks like it is made of a <b>ice</b> (a very complex <b>ice</b>), so, the <b>custom model</b> we want to make containing this <b>ice effect</b> must be modeled in a way that imitates the shape of this object. Our <b>ice model</b> must be divided in <b>3 pieces</b>: an <b>external figure</b>, an <b>intermediate figure</b> and a figure that is <b>contained in both figures</b> (<b>Fig. 4</b>). </p>

      <img src="../../images/t5/fig4.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 4 - Example figure)</p>
      <br>

      <p>I decided to make a <b>stalactite-type model</b> in (<b>Fig. 5</b>). The <b>external</b> and <b>intermediate objects</b> were shaped almost the same on the <code>IceRingIcePlanet</code> model so I made those on my model look the same, I just scaled them a little bit to put <b>one inside another</b> (they were made out of a cube --> <a href="https://www.youtube.com/watch?v=NvzOErzvcqM">Link</a>). And the object inside both figures was made using <b>Particle Effects</b> (<a href="https://www.youtube.com/watch?v=1gM8yEMFMjg">Link</a>) using <b>planes</b> (as the <b>particles</b>) and the <b>Boolean Modifier</b> on another <b>Blender project</b> so no dumb stuff happens on the main one (<a href="https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/booleans.html">Link</a>).</p>

      <img src="../../images/t5/fig5.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 5 - Stalactite-type custom model pieces)</p>
      <br>

      <p>Apply the <b>respective materials to each figure</b> <code>BackFaceMat</code> for the <b>external figure</b>, <code>FaceMat</code> for the <b>intermediate figure</b> and <code>CrackMat_v</code> to the <b>figure inside both figures</b> (<b>Fig. 6a, 6b and 6c</b>). Remember to do the <b>unwrap options</b>. Use <b>vertex paint</b> and/or <b>shade smooth</b> as you like.</p>

      <img src="../../images/t5/fig6a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 6a)</p>
      <br>

      <img src="../../images/t5/fig6b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 6b)</p>
      <br>

      <img src="../../images/t5/fig6c.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 6c)</p>
      <br>

      <p>As we are dealing with <b>materials</b> inside <b>materials</b> we have to be careful with the <b>normals of the faces</b>, in other words, in which direction faces point in each figure: to the <b>outside</b> or the <b>inside</b> of the figure. This is because the visual effect on a <b>material</b> depends on the face direction. To view the <b>normals</b> of a figure hit the <code>N</code> key while being in <b>Edit Mode</b> selecting all faces on a figure, scroll down to <code>Mesh Display</code> and, in the <code>Normals</code> section, click on the <b>face selection</b> and set a size to the <b>normals displayed</b> (<b>Fig. 7</b>). To <b>flip the orientation of the normals</b> go to <code>Shading / UV > Normals: > Flip Direction</code> (be sure to select the whole figure in <b>Edit Mode</b> when doing this, <b>Fig. 8</b>). By default, when you create a figure in <b>Blender</b>, the <b>normals</b> will be set to the <b>outside</b> of the figure.</p>

      <img src="../../images/t5/fig7.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 7 - Display normals in faces)</p>
      <br>

      <img src="../../images/t5/fig8.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 8 - Flip faces normals)</p>
      <br>

      <p>Back in the <b>DAE model</b> we can see that it has the faces for its <b>external figure</b> pointing <b>inwards</b> and the <b>intermediate one</b> pointing <b>outwards</b> (<b>Figs. 9a, 9b and 9c</b>).</p>

      <img src="../../images/t5/fig9a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 9a - Normals in DAE external figure pointing inwards)</p>
      <br>

      <img src="../../images/t5/fig9b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 9b - Normals in DAE intermediate figure pointing outwards)</p>
      <br>

      <img src="../../images/t5/fig9c.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 9c - Normals in DAE internal figure)</p>
      <br>

      <p>Then, for this <b>ice effect</b> setup we will follow <b>the same face orientation each part of the respective DAE model has</b>: <b>normals</b> on the external figure point <b>inwards</b> (<b>Fig. 9d</b>) and <b>outwards</b> on the <b>intermediate</b> part (<b>Figs. 9e and 9f</b>).</p>

      <img src="../../images/t5/fig9d.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 9d - Normals in custom model external figure pointing inwards)</p>
      <br>

      <img src="../../images/t5/fig9e.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 9e - Normals in custom  model intermediate figure pointing inwards)</p>
      <br>

      <img src="../../images/t5/fig9f.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 9f - Normals in custom model internal figure)</p>
      <br>

      <hr>
      <p><b>NOTE 1:</b> You can't actually tell to which direction the <b>internal figure's faces point</b> since it isn't a <b>closed surface</b>. Any direction will be fine so you can keep the default one <b>Blender</b> applies.</p>
      <hr>
      <br>

      <p>The final step will be <b>ordering the objects</b> on <b>Blender</b> (by changing their names) in the following way: the most <b>external figure first</b>, the <b>figure inside both figures second</b> and the <b>intermediate figure third</b> (as the order shown in the <code>IceRingIcePlanet</code> <b>DAE model</b>, <b>Fig. 10</b>). This is done because the order will affect how <b>SuperBMD</b> applies the <b>materials</b> to the <b>custom model</b> and consequently will affect the looks of the object in game.</p>

      <img src="../../images/t5/fig10.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 10 - Name order respective to each figure)</p>
      <br>

      <p>Now, after all that, <b>"compile"</b> the model using <b>SuperBMD</b> using the <code>--nosort</code> option at the end of the command (<b>IMPORTANT</b>). This will ensure the <b>proper material effect</b>.</p>

      <p><code>path\to\SuperBMD.exe [your_model].fbx --mat [your-materials].json --texheader [your-textures].json --rotate --nosort</code></p>
      
      <br>
      <hr>
      <p><b>NOTE 2:</b> <b>Linux users</b>, remember to use a forward slash instead of a backslash for paths!</p>
      <hr>
      <br>

      <p>Now you can open the converted model file on <b>j3dview</b>, save it as <b>BDL</b> in a folder with the same name as the model, do the rest of the stuff to <b>import the model in game</b> and you will get what is shown on <b>Fig. 11</b>.</p>

      <img src="../../images/t5/fig11.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 11 - Mario staring at some nice looking ice)</p>        
      <br>
      
      <hr>
      <p><b>NOTE 3:</b> Thanks to <b>Zyphro</b> for the guidence.</p>
      <hr>
      <br>

    </div>

  </body>

</html>
